#define _CRT_SECURE_NO_WARNINGS 1

class Solution
{
public:
    vector<int> twoSum(vector<int>& numbers, int target)
    {
        vector<int> ret;
        int left = 0, right = numbers.size() - 1;
        while (left < right)
        {
            if ((numbers[left] + numbers[right]) == target)
            {
                ret.push_back(left + 1);
                ret.push_back(right + 1);
                return ret;
            }
            else if ((numbers[left] + numbers[right]) > target) {
                right--;
            }
            else {
                left++;
            }
        }
        return ret;
    }
};